import {AllcontentsList,AlllistsList,SonglistDetails} from '@/api/api.js'
const state={
//所有榜单内容摘要
list:[],
//获取歌单详情
playlisttracks:[]
};
const mutations ={
//所有榜单内容摘要
ALLCONTENTSLIST(state,list){
  state.list = list
},
//获取歌单详情
SONGLISTDETAILS(state,playlisttracks){
  state.playlisttracks.push(playlisttracks)
},
};
const actions={
//所有榜单内容摘要
 async getAllcontentsList({commit}){
  let request = await AllcontentsList()
  console.log(request);
  if(request.data.code==200){
    commit('ALLCONTENTSLIST',request.data.list)
  }
  },
  //所有榜单内容摘要
 async getAlllistsList({commit}){
   let request = await AlllistsList()
  },
  //获取歌单详情
 async getSonglistDetails({commit},{id}){
  let request = await SonglistDetails(id)
  if(request.data.code==200){
    commit('SONGLISTDETAILS',request.data.playlist.tracks)
  }
  }
};
const getter={

};
export default{
  state,
  mutations,
  actions,
  getter
}